import type { DynamicProps } from '/#/utils';
import type { BasicTableProps, BasicColumn } from '/@/components/Table/src/types/table';
import { FormProps } from '/@/components/Table';
import { FormSchema } from '/@/components/Form';
import { getgatewaydrive } from '/@/api/sys/gateway/gateway';
type Props = Partial<DynamicProps<BasicTableProps>>;
// 列配置
const tableColumns: BasicColumn[] = [
  {
    title: '驱动编号',
    dataIndex: 'id',
    width: 60,
  },
  {
    title: '驱动名称',
    dataIndex: 'name',
    width: 130,
  },

  {
    title: '驱动版本',
    dataIndex: 'version',
    width: 100,
  },
  {
    title: '驱动类型',
    dataIndex: 'connect_type',
    width: 100,
  },
];
const searchSchemas: FormSchema[] = [
  {
    field: 'drive_name',
    component: 'Input',
    label: '驱动名称',
    labelWidth: 80,
    componentProps: {
      placeholder: '',
    },
    colProps: {
      span: 6,
    },
  },
];
export const formConfig: Partial<FormProps> = {
  labelWidth: 100,
  schemas: searchSchemas,
  actionColOptions: {
    span: 4,
    style: { textAlign: 'left', marginLeft: '20px' },
  },
};
export const tableConfig: Props = {
  api: getgatewaydrive,
  columns: tableColumns,
  useSearchForm: true,
  formConfig: formConfig,
  clickToRowSelect: false,
  showTableSetting: false,
  showIndexColumn: false,
  rowKey: 'id',
  bordered: true,
  fetchSetting: {
    listField: 'list',
    totalField: 'total',
    sizeField: 'page_size',
  },
  actionColumn: {
    width: 80,
    title: '操作',
    slots: { customRender: 'action' },
  },
};
